#include<stdio.h>
#include<stdlib.h>

#define SIZE 1024

char buf[SIZE+1];

int main(int argc,char* argv[])
{
    if(argc == 1)
    {
        printf("LUNZIP: file1 file2 ...\n");
        exit(1);
    }
    FILE* fp = fopen(argv[1],"rb");
    if(fp == NULL)
    {
        perror("LUNZIP");
        exit(1);
    }
    while(!feof(fp))
    {
        int num = fread(buf,1,5,fp);
        if(num == 5)
        {
            int count = *(int*)buf;
            char ch = buf[4];
            for(int i = 0; i < count; ++i)
                printf("%c",ch);
        }
        else
        {
            for(int i = 0; i < num; ++i)
                printf("%c",buf[i]);
        }
    }
    return 0;
}